package com.graduationdesign.zengyan.graduationdesignapp.domainLayer;

import com.graduationdesign.zengyan.graduationdesignapp.dataLayer.profileRepository.MainService;

import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;

/**
 * Created by ZengYan on 2018/4/16.
 *
 * @desc :
 */
public class DomainHandler implements PresentData{

    private MainService mMainService;

    public DomainHandler(MainService mMainService) {
        this.mMainService = mMainService;
    }

    Observable<String> nameObservable;
    ObservableEmitter<String> nameEmitter;

    public void start(){
    }


    @Override
    public Observable<String> getName(String stuNum) {
        if (nameObservable == null) {
            nameObservable = Observable.create(new ObservableOnSubscribe<String>() {
                @Override
                public void subscribe(ObservableEmitter<String> e) throws Exception {
                    nameEmitter = e;
                }
            });
        }

        return nameObservable;
    }

    @Override
    public Observable<String> getAge(String stuNum) {
        return null;
    }
}
